package com.legal.domain.po.practice_view;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * VIEW - 练习记录列表
 * </p>
 *
 * @author xiaopeng
 * @since 2025-06-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("practice_records_list_view")
@Schema(name = "PracticeRecordsListView", description = "刷题记录视图")
public class PracticeRecordsListView implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "分类名称", example = "Java基础知识")
    private String categoryName;

    @Schema(description = "用户编号", example = "U10001")
    private String userNo;

    // 添加一个逻辑主键字段（选择视图中能唯一标识记录的字段）
    @TableId(type = IdType.INPUT)  // INPUT表示使用自定义ID
    @Schema(description = "逻辑主键（记录编号）", example = "R20250001")
    private String recordNo;

    @Schema(description = "总题数", example = "20")
    private Integer totalQuestions;

    @Schema(description = "答对题数", example = "15")
    private Integer correctCount;

    @Schema(description = "得分", example = "75.5")
    private BigDecimal score;

    @Schema(description = "持续时间(秒)", example = "1800")
    private Integer duration;

    @Schema(description = "创建时间", example = "2025-06-27T10:00:00")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private LocalDateTime createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Schema(description = "开始时间", example = "2025-06-27")
    private LocalDateTime startTime;


    @Schema(description = "结束时间", example = "2025-06-27")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime endTime;
}
